DRM rights consumption in Android

37 views
Skip to first unread message

Atish

unread,
Oct 13, 2009, 8:32:53 AM10/13/09
to android-porting
Hi All,
I m trying to run CPM plugin thru opencore for playing DRM contents in
Android.

I was succesfule in registrering and checking the rights for DRM
content thru CPM plugin.

But consuming rights is not working because of below mentioned reason.

Push(iCPMContainer, PVMFSubNodeContainerBaseMp3::ECPMUsageComplete);
This command will enque the consume rights commands
(ECPMUsageComplete).But this code is present in DoReset.

So how do reset will be invoked??
Current android music player doesnot even call stop.

so ECPMUsageComplete is not getting called...
how to solve this issue...???

NoraBora

unread,
Oct 13, 2009, 9:44:05 PM10/13/09
to android...@googlegroups.com
DoReset() is invoked by MediaPlayer.reset();

2009/10/13 Atish <atis...@gmail.com>

Atish

unread,
Oct 13, 2009, 11:50:25 PM10/13/09
to android-porting
But Currently android music player doesnot call Reset.That means it
can play DRM files with no constratint!!!!

So where should i put that UsuageComplete code so that every case is
considered??

On Oct 14, 6:44 am, NoraBora <noranb...@gmail.com> wrote:
> DoReset() is invoked by MediaPlayer.reset();
>
> 2009/10/13 Atish <atish...@gmail.com>
> > how to solve this issue...???- Hide quoted text -
>
> - Show quoted text -

NoraBora

unread,
Oct 14, 2009, 3:32:10 AM10/14/09
to android...@googlegroups.com
I didn't know the default music player doesn't call MediaPlayer.Reset().

How about you put such as ConsumeRight() in CPM's AuthorizeUsage() not in CPM's UsageComplete()?
In this case the consumption happens before playback.

2009/10/14 Atish <atis...@gmail.com>

Atish

unread,
Oct 14, 2009, 9:07:27 AM10/14/09
to android-porting
Thanks for Replying...

I have already tried that.

CPM's AuthorizeUsage() will be called only once when u start playing a
new media file.

Once play is finished node will be in paused state.So if u start
playing again node will go to Start state.
PvPlayerEngine->Resume->ParserNode->Start.
So AuthorizeUsage() won't be called.

As all the cpm calls are enqued in Init of Parser node only if u
change media file or call Reset from App then only cpm commands will
be invoked.

Please guide me what to do in this scenario???


On Oct 14, 12:32 pm, NoraBora <noranb...@gmail.com> wrote:
> I didn't know the default music player doesn't call MediaPlayer.Reset().
>
> How about you put such as ConsumeRight() in CPM's AuthorizeUsage() not in
> CPM's UsageComplete()?
> In this case the consumption happens before playback.
>
> 2009/10/14 Atish <atish...@gmail.com>
>
>
>
>
>
> > But Currently android music player doesnot call Reset.That means it
> > can play DRM files with no constratint!!!!
>
> > So where should i put that UsuageComplete code so that every case is
> > considered??
>
> > On Oct 14, 6:44 am, NoraBora <noranb...@gmail.com> wrote:
> > > DoReset() is invoked by MediaPlayer.reset();
>
> > > 2009/10/13 Atish <atish...@gmail.com>
>
> > > > Hi All,
> > > > I m trying to run CPM plugin thru opencore for playing DRM contents in
> > > > Android.
>
> > > > I was succesfule in registrering and checking the rights for DRM
> > > > content thru CPM plugin.
>
> > > > But consuming rights is not working because of below mentioned reason.
>
> > > >  Push(iCPMContainer, PVMFSubNodeContainerBaseMp3::ECPMUsageComplete);
> > > > This command will enque the consume rights commands
> > > > (ECPMUsageComplete).But this  code is present in DoReset.
>
> > > > So how do reset will be invoked??
> > > > Current android music player doesnot even call stop.
>
> > > > so ECPMUsageComplete is not getting called...
> > > > how to solve this issue...???- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -

NoraBora

unread,
Oct 15, 2009, 3:28:46 AM10/15/09
to android...@googlegroups.com
I tested what you said.
MediaPlayer.start() ... wait...play complete..MediaPlayer.start()
In the second start(), none of the cpm function called.

Under this opencore structure,
all I can think of is to reset MediaPlayer in CompletionListener.

I hope there is a better solution.

2009/10/14 Atish <atis...@gmail.com>

Atish

unread,
Oct 15, 2009, 5:01:51 AM10/15/09
to android-porting
yeah we can do that but i feel that won't be a gud solution as anybody
can write an application which won't call reset.
So that app can play the DRM content for ever by continous playing the
file.

So some changes need to be done in ParserNode level so that each time
node goes from pause to start it should at least call AuthorizeUsuage
and UsuageComplete..

what do u say??

On Oct 15, 12:28 pm, NoraBora <noranb...@gmail.com> wrote:
> I tested what you said.
> MediaPlayer.start() ... wait...play complete..MediaPlayer.start()
> In the second start(), none of the cpm function called.
>
> Under this opencore structure,
> all I can think of is to reset MediaPlayer in CompletionListener.
>
> I hope there is a better solution.
>
> 2009/10/14 Atish <atish...@gmail.com>

NoraBora

unread,
Oct 15, 2009, 5:22:07 AM10/15/09
to android...@googlegroups.com
   Yes. the app can play a drm content with one consumption(because AuthorizeUsage called during prepare) until reset(). but isn't this a normal scenario?
   Imagine that near the playback end, user can seek to the first and can watch forever by one consumption. What's the difference?

   If you really want the drm content to be played only once with one consumption, maybe you could try using intents like BITMASK_PVMF_CPM_DRM_INTENT_RESUME, BITMASK_PVMF_CPM_DRM_INTENT_SEEK_BACK in parser nodes. (I haven't used them yet..)

2009/10/15 Atish <atis...@gmail.com>

Atish

unread,
Oct 15, 2009, 9:47:04 AM10/15/09
to android-porting
Whatever u said is absolutely correct.But imaging actual use case
scenario user doesnot want to remain in the player screen to play the
content infinitely(unless he is fanatic about the song!!!)

But what i m talking about is u can come out of the player app and
anytime u can go n start playing.
As nobody called reset or stop all nodes will retain their STATE
(PAUSED).Next time it will start from PAUSED STATE ONLY. :(

If we can consume rights during START(STATE) or PAUSED/STOPPED
(whichever is called by app) then at least we will save some royalty
to the operator...

what do u say??isn't there any way to move the usage complete code to
any other state??

On Oct 15, 2:22 pm, NoraBora <noranb...@gmail.com> wrote:
>     Yes. the app can play a drm content with one consumption(because
> AuthorizeUsage called during prepare) until reset(). but isn't this a normal
> scenario?
>    Imagine that near the playback end, user can seek to the first and can
> watch forever by one consumption. What's the difference?
>
>    If you really want the drm content to be played only once with one
> consumption, maybe you could try using intents like
> BITMASK_PVMF_CPM_DRM_INTENT_RESUME, BITMASK_PVMF_CPM_DRM_INTENT_SEEK_BACK in
> parser nodes. (I haven't used them yet..)
>
> 2009/10/15 Atish <atish...@gmail.com>

NoraBora

unread,
Oct 15, 2009, 9:00:06 PM10/15/09
to android...@googlegroups.com

2009/10/15 Atish <atis...@gmail.com>


Whatever u said is absolutely correct.But imaging actual use case
scenario user doesnot want to remain in the player screen to play the
content infinitely(unless he is fanatic about the song!!!)

But what i m talking about is u can come out of the player app and
anytime u can go n start playing.
As nobody called reset or stop all nodes will retain their STATE
(PAUSED).Next time it will start from PAUSED STATE ONLY. :(

If we can consume rights during START(STATE) or PAUSED/STOPPED
(whichever is called by app) then at least we will save some royalty
to the operator...

       I'm not sure I understand what you are saying.
       "start playing drm.mp3 -> drm consumption -> get out of the app(still playing) ->
        go back to the app -> another drm consumption."
       Is this what you want?


what do u say??isn't there any way to move the usage complete code to
any other state??

       if you call UsageComplete() in START state, MediaPlayer.start->pause->start->pause will cause consumption many times..I think.

Malapati Raghavendra

unread,
Oct 16, 2009, 4:26:30 AM10/16/09
to android...@googlegroups.com
Hi All,
 
I am also looking the same information ....
I think Atish is expecting the same ,
 
As i observed in the code Rights are consumed only once and it will play infinite times.
In order to Consume rights we need to call Reset() once we reached to the end of track information,
or Move UsageComplete code to some other location.
 
What is the better solution ?
 
Regards,
Raghu.M 

RaviY

unread,
Oct 17, 2009, 1:16:38 AM10/17/09
to android-porting
Are you saying that you want to consume a right every time the clip is
either paused, or stopped, or played in a loop?

Atish

unread,
Oct 17, 2009, 7:23:04 AM10/17/09
to android-porting
i want to consume rights each time is played(completely...)

So i thought of moving the UsuageComplete code to DoPause or DoStart .

and i'll check file start or file end in method so that it'll consume
the rights only once during one time play...

is there any better method to do it??

RaviY

unread,
Oct 17, 2009, 11:10:50 AM10/17/09
to android-porting
That would mean that you want to consume a license for every play in a
loop. Right?

As a consumer, that is a very bad scenario. Also, it introduces
trickcy situations/questions like, what does "played completely" mean?
Does it mean that the last sample/frame has been rendered? Or, does
that mean that the last sample has retrieved from the file (assuming
file playback as an example)?

As I mentioned earlier, probably in some other thread, "UsageComplete"
should not have anything to do with rights consumption. Decrementing
the DRM counter should be done in "AuthorizeUsage".

Checking the start or end of file (assuming you mean the duration) is
not a fool proof way. I could be wicked and reposition to the 1st
second, instead of starting from 0. What would you do then?

-Ravi

Atish

unread,
Oct 20, 2009, 5:39:17 AM10/20/09
to android-porting
Yeah that is correct...in that case only option i m left with is to
Change the Music app code.

So after completion it will do a reset.That will do the things for me.

But i m worried that if somebody will write a test app where he won't
call reset...in that case he can play DRM FILE forever what do u say??
how to handle that case???

Thanks and Regards,
Atish

On Oct 17, 8:10 pm, RaviY <yend...@pv.com> wrote:
> That would mean that you want to consume a license for every play in a
> loop. Right?
>
> As a consumer, that is a very bad scenario. Also, it introduces
> trickcy situations/questions like, what does "played completely" mean?
> Does it mean that the last sample/frame has been rendered? Or, does
> that mean that the last sample has retrieved from the file (assuming
> file playback as an example)?
>
> As I mentioned earlier, probably in some other thread, "UsageComplete"
> should not have anything to do with rights consumption. Decrementing
> the DRM counter should be done in "AuthorizeUsage".
>
> Checking the start or end of file (assuming you mean the duration) is
> not a fool proof way. I could be wicked and reposition to the 1st
> second, instead of starting from 0. What would you do then?
>
> -Ravi
>
> On Oct 17, 6:23 am,Atish<atish...@gmail.com> wrote:
>
> > i want to consume rights each time is played(completely...)
>
> > So i thought of moving the UsuageComplete code to DoPause or DoStart .
>
> > and i'll check file start or file end in method so that it'll consume
> > the rights only once during one time play...
>
> > is there any better method to do it??
>
> > On Oct 17, 10:16 am, RaviY <yend...@pv.com> wrote:
>
> > > Are you saying that you want to consume a right every time the clip is
> > > either paused, or stopped, or played in a loop?
>
> > > On Oct 15, 8:47 am,Atish<atish...@gmail.com> wrote:
>
> > > > Whatever u said is absolutely correct.But imaging actual use case
> > > > scenario user doesnot want to remain in the player screen to play the
> > > > content infinitely(unless he is fanatic about the song!!!)
>
> > > > But what i m talking about is u can come out of the player app and
> > > > anytime u can go n start playing.
> > > > As nobody called reset or stop all nodes will retain their STATE
> > > > (PAUSED).Next time it will start from PAUSED STATE ONLY. :(
>
> > > > If we can consume rights during START(STATE) or PAUSED/STOPPED
> > > > (whichever is called by app) then at least we will save some royalty
> > > > to the operator...
>
> > > > what do u say??isn't there any way to move the usage complete code to
> > > > any other state??
>
> > > > On Oct 15, 2:22 pm, NoraBora <noranb...@gmail.com> wrote:
>
> > > > >     Yes. the app can play a drm content with one consumption(because
> > > > > AuthorizeUsage called during prepare) until reset(). but isn't this a normal
> > > > > scenario?
> > > > >    Imagine that near the playback end, user can seek to the first and can
> > > > > watch forever by one consumption. What's the difference?
>
> > > > >    If you really want the drm content to be played only once with one
> > > > > consumption, maybe you could try using intents like
> > > > > BITMASK_PVMF_CPM_DRM_INTENT_RESUME, BITMASK_PVMF_CPM_DRM_INTENT_SEEK_BACK in
> > > > > parser nodes. (I haven't used them yet..)
>
> > > > > 2009/10/15Atish<atish...@gmail.com>
>
> > > > > > yeah we can do that but i feel that won't be a gud solution as anybody
> > > > > > can write an application which won't call reset.
> > > > > > So that app can play the DRM content for ever by continous playing the
> > > > > > file.
> > > > > > So some changes need to be done in ParserNode level so that each time
> > > > > > node goes from pause to start it should at least call  AuthorizeUsuage
> > > > > > and UsuageComplete..
>
> > > > > > what do u say??
>
> > > > > > On Oct 15, 12:28 pm, NoraBora <noranb...@gmail.com> wrote:
> > > > > > > I tested what you said.
> > > > > > > MediaPlayer.start() ... wait...play complete..MediaPlayer.start()
> > > > > > > In the second start(), none of the cpm function called.
>
> > > > > > > Under this opencore structure,
> > > > > > > all I can think of is to reset MediaPlayer in CompletionListener.
>
> > > > > > > I hope there is a better solution.
>
> > > > > > > 2009/10/14Atish<atish...@gmail.com>
>
> > > > > > > > Thanks for Replying...
>
> > > > > > > > I have already tried that.
>
> > > > > > > > CPM's AuthorizeUsage() will be called only once when u start playing a
> > > > > > > > new media file.
>
> > > > > > > > Once play is finished node will be in paused state.So if u start
> > > > > > > > playing again node will go to Start state.
> > > > > > > > PvPlayerEngine->Resume->ParserNode->Start.
> > > > > > > > So AuthorizeUsage()  won't be called.
>
> > > > > > > > As all the cpm calls are enqued in Init of Parser node only if u
> > > > > > > > change media file or call Reset from App then only cpm commands will
> > > > > > > > be invoked.
>
> > > > > > > > Please guide me what to do in this scenario???
>
> > > > > > > > On Oct 14, 12:32 pm, NoraBora <noranb...@gmail.com> wrote:
> > > > > > > > > I didn't know the default music player doesn't call
> > > > > > MediaPlayer.Reset().
>
> > > > > > > > > How about you put such as ConsumeRight() in CPM's AuthorizeUsage()
> > > > > > not in
> > > > > > > > > CPM's UsageComplete()?
> > > > > > > > > In this case the consumption happens before playback.
>
> > > > > > > > > 2009/10/14Atish<atish...@gmail.com>
>
> > > > > > > > > > But Currently android music player doesnot call Reset.That means it
> > > > > > > > > > can play DRM files with no constratint!!!!
>
> > > > > > > > > > So where should i put that UsuageComplete code so that every case
> > > > > > is
> > > > > > > > > > considered??
>
> > > > > > > > > > On Oct 14, 6:44 am, NoraBora <noranb...@gmail.com> wrote:
> > > > > > > > > > > DoReset() is invoked by MediaPlayer.reset();
>
> > > > > > > > > > > 2009/10/13Atish<atish...@gmail.com>

RaviY

unread,
Oct 20, 2009, 9:22:15 AM10/20/09
to android-porting
You haven't answered the what "played completely" means.

From OpenCORE perspective, consuming a license once per iteration in a
loop is not supported. I can also say that we don't have any immediate
plans to support the usecase.

Since you are in android-porting, you are free to change OpenCORE code
for your use. So, what you could do is in HandleSinkNodeInfoEvent()
[inside pv_player_engine.cpp, search for
"PVP_ENGINE_COMMAND_PAUSE_DUE_TO_ENDOFCLIP". This is a command that we
issue at the end of playback of a clip. Here, instead of pausing, you
could issue and internal RESET. This will make sure that at the end of
a completed playback session (i.e., all audio/video samples have been
rendered), you would clean up the session. And, in the
PlayerDriver::Run(), you would need to restart the playback session in
the section of code if (mDoLoop) { }.

Regarding your question: "But i m worried that if somebody will write
a test app where he won't call reset...in that case he can play DRM
FILE forever what do u say?? how to handle that case???" .... as I
said, there is no good way around it. As an example, one could do a
reposition in the last second of the clip, and playback from the
beginning. In your usecase, wouldn't that be allowed?


-Ravi

Atish

unread,
Oct 20, 2009, 10:05:47 AM10/20/09
to android-porting
Thanks Ravi for your reply it's a great help...
"played completely" for this i was checking end of file in Pause State
(TRACKSTATE_ENDOFTRACK)

if track state is TRACKSTATE_ENDOFTRACK then consume rights otherwise
do not...

Is it a safer method to try??

n Regarding ur query
"As an example, one could do a
> reposition in the last second of the clip, and playback from the
> beginning. In your usecase, wouldn't that be allowed?"

i think this case cannot be handled nywys...whatever u do....

i'll try whatever u have suggested..thanks for it..


so whatever time

Atish

unread,
Oct 21, 2009, 12:13:24 AM10/21/09
to android-porting
Hi Ravi I tried ur idea it worked well....But i wanted that change for
only DRM contents.Is there any way that i can find out a media content
is DRM or not in engine??

Is it advisable to reset each time
(PVP_ENGINE_COMMAND_PAUSE_DUE_TO_ENDOFCLIP)for every type of
media ???
Reply all
Reply to author
Forward
0 new messages